package com.sky.controller.user;

import com.sky.result.Result;
import io.swagger.models.auth.In;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController("userShopController")
@RequestMapping("/user/shop")
@Slf4j
public class ShopController {
    @Autowired
    private RedisTemplate redisTemplate;
    /**
     * 获取店铺状态
     */
    @GetMapping("/status")

    public Result<Integer> getStatus(){
        Object shopStatus = redisTemplate.opsForValue().get("SHOP_STATUS");
        Integer status = Integer.parseInt(shopStatus.toString());
        log.info("营业状态:{}", status==1?"营业中":"打烊中");
        return Result.success(Integer.parseInt(shopStatus.toString()));
    }
}
